package homework_six;

public class Rectangle extends Shape {
    private double width;
    private double height;

    public Rectangle() {
    }

    public Rectangle(String color, double width, double height) {
        super(color);
        this.width = width;
        this.height = height;
    }

    public double getArea() {
        return width * height;
    }

    public double getPer() {
        return (width + height) * 2;
    }

    public void showAll() {
        System.out.println("图形类型 ：" + "Rectangle");
        System.out.println("颜色    ：" + getColor());
        System.out.println("长      ：" + height);
        System.out.println("宽      ：" + height);
        System.out.println("周长    ：" + getPer());
        System.out.println("面积    ：" + getArea());
        System.out.println(" ");
    }
}
